package com.koron.operation.classes.form.bean.convertor;

import com.koron.operation.classes.form.bean.dto.ClassesFormRecordDTO;
import com.koron.operation.classes.form.bean.po.ClassesFormRow;
import com.koron.operation.classes.form.bean.po.ClassesFormShift;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

import java.util.List;


/**
 * @author jzp
 * @since 2023/5/17
 */
@Mapper(componentModel = "spring")
public interface ClassesFormConvertor {

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "sort", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "rowId", source = "id")
    ClassesFormShift rowToShift(ClassesFormRow classesFormRow);

    @InheritConfiguration
    void rowFillShift(ClassesFormRow classesFormRow, @MappingTarget ClassesFormShift classesFormShift);

    List<ClassesFormShift> rowListToShiftList(List<ClassesFormRow> classesFormRowList);

    ClassesFormRecordDTO entityToFormRecordDTO(ClassesFormShift classesFormShift);
}
